namespace SampleApp.Tests {
    using Microsoft.Services.TestTools.UITesting.Html;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using SampleApp.Tests.Pages;

    [CodedUITest]
    public class ProductCreateTests : PageTest<ProductsCreate>{
        
        [TestMethod]
        public void DisplaysValidationErrorsWhenCreatingProductWithEmptyName() {

            TestedPage.CreateNewProduct(
                productName:    string.Empty, 
                price:          "1");
            bool validationMessage = TestedPage.ValidationMessageIsDisplayedForField("Name");

            Assert.IsTrue(validationMessage, "No validation message was shown");
        }

    }
}